[#ftl]
[#if !host??]
[#assign host = "http://beyond-prototype.xyz"/]
[/#if]
[#if !webAppHost??]
[#assign webAppHost = ""/]
[/#if]
[#assign uploadDir ="/tmp/"/]
[#assign localStorage = true/]
[#assign webAppVersion = "1.0.1"/]
[#assign shrinkCached = false/]
[#if !shrink??]
[#assign shrink = false/]
[/#if]
[#if !applicationMode??]
[#assign applicationMode = "DEV"/]
[/#if]
[#if !hasServerResource??]
[#assign hasServerResource = false/]
[/#if]
[#assign shrinksafe1 = "angel.core.freemarker.Shrinksafe"?new()]
[#assign ShrinksafeSimple = true/]
[#assign ShrinksafeExterns]
	function dojo(){}; 
	dojo.addOnLoad=function(){};
	dojo.registerModulePath=function(){};
	dojo.require=function(){};	
	function console(){};
	console.log=function(){};
	function window(){};
	window.localStorage=function(){};
	function loadingMessage(){};
	function errorMessage(){};
[/#assign]
[#global jsCopyright]
/**
 * [#if shrink]@preserve[/#if] Copyright @ 2018 Beyond Prototype. All rights reserved.
 */
[/#global]
[#global ShrinksafeMethodKeyWords][/#global]
[#global ShrinksafeKeyWords][/#global]
[#macro bootstrapChains message=""]
[#if eager??&&eager]
  [#nested]
[#else]
_bootstrapChains[_bootstrapChains.length]=function(){
	[#if message!=""]
	showLoadingMessage("${message}");
	[/#if]
 	[#nested]
 	window.setTimeout(_bootstrapLoader,20);
 };
[/#if]
[/#macro]                         
[#macro shrinksafe key cached=shrinkCached shrink=shrink contentType="script" CompilationLevel=""]
	[@shrinksafe1 key=key cached=cached shrink=shrink contentType=contentType CompilationLevel=CompilationLevel]
		[#nested][#if shrink]/*END_OF_shrinksafe*/[/#if]
	[/@]
[/#macro]

[#macro messageUtility] 
	window["showLoadingMessage"] = function(message){
		dom.byId("errorMsg").innerHTML = message + ",please wait...";
	};
	
	window["showErrorMessage"] = function(message){
		dom.byId("errorMsg").innerHTML = "<span style='color:red'>"+message + "</span><br/><span style='color:blue;font-style:italic'>please contact  beyondprototype@126.com</span>";	
	};
	window["showWarningMessage"] = function(message){
		dom.byId("warningMsg").innerHTML = "<span style='color:red'> WARNING! </span> <span style='color:red'>"+message + "</span>";
	};
[/#macro]	
[#macro showWarningMessage]

	console.log("navigator.userAgent=",navigator.userAgent);
	console.log("navigator.appVersion=",navigator.appVersion);
//	console.log("dojo.isWebKit=",has("webkit"));
//	console.log("dojo.isMozilla=",has("mozilla"));
//	console.log("dojo.isOpera=",has("opera"));
//	console.log("dojo.isFF=",has("ff"));
//	console.log("dojo.isSafari=",has("safari"));
//	console.log("dojo.isChrome=",has("chrome"));
//	console.log("dojo.isIE=",has("ie"));
(function(){
	var compatibleBrowser = undefined;
	var compatible = false;
	if(has("ie") != undefined){
		if(has("ie") < 10){
			compatibleBrowser = 10;
		}else{
			compatible = true;
		}
	}else if(has("ff") != undefined){
		if(has("ff") < 30){
			compatibleBrowser = 30;
		}else{
			compatible = true;
		}
	}else if(has("opera") != undefined){
		if(has("opera") < 23){
			compatibleBrowser = 23;
		}else{
			compatible = true;
		}
	}else if(has("chrome") != undefined){
		if(has("chrome") < 36){
			compatibleBrowser = 36;
		}else{
			compatible = true;
		}
	}else if(navigator.appVersion.indexOf("rv:11") != -1 && has("ie") == undefined){	
			compatible = true;
			compatibleBrowser = 11;
	}		
	

	if(!compatible){
		//if(compatibleBrowser == undefined){
			[#assign incompatibleWarning]Your browser may not be compatible, please use one of browsers below:<br> IE(10+), FireFox(30+), Opera(23+), Chrome(36+)[/#assign]
			showWarningMessage("${incompatibleWarning}");	
		//}else{
		//	showWarningMessage("Your browser may not be compatible, please use a higher version no less than " + compatibleBrowser);
		//}		    		
	}
})();	
[/#macro]

[#macro metaKeywords]
Beyond Prototype is an online application that can help business analysis, user interface designer, and software engineer to create high quality and reusable prototype without coding. 
Beyond Prototype is built on open standard technologies such as DOJO, HTML5 and CSS3, meanwhile it provides comprehensive tutorials for software engineers to learn DOJO, HTML5 and CSS3.
WYSIWYG (What You See Is What You Get) is the design principal for Beyond Prototype, there are plenty of built-in widgets in Beyond Prototype. 
You can pick up any favorite widget to create your application prototype at the user requirement gathering phase; you can also export the source code of prototype that can be used in the development phase later on.
[/#macro]

[#macro dynamicLoader]
function _loadCss(url){	
	var urls = url;
	if(typeof url == "string"){
		urls = [url];
	} 	
	for(var i = 0, size = urls.length; i < size; i++){
		var link = document.createElement("link"); 
	 	link.type = "text/css"; 
	 	link.rel = "stylesheet"; 
	 	link.href = urls[i]; 
	 	document.head.appendChild(link);
	}
	
 }; 
 function _loadScript(url){ 
	var urls = url;
	if(typeof url == "string"){
		urls = [url];
	} 	
	for(var i = 0, size = urls.length; i < size; i++){
	 	var script = document.createElement("script"); 
	 	script.type = "text/javascript"; 
	 	script.src = urls[i];
	 	document.head.appendChild(script); 
	}
 }; 
 function _preloadImage(url){
	 var urls = url;
	if(typeof url == "string"){
		urls = [url];
	} 
	for(var i = 0, size = urls.length; i < size; i++){
		var image = new Image(); 	  	
		image.src = urls[i];
	}			
 } 
[/#macro]

[#macro funcCreateIframe]
window["_createIframe"] = function (url){
	var iframe = document.createElement("iframe");
	iframe.width = iframe.height = "0px";	
	iframe.style.cssText="display:none";
	iframe.src=url;
	document.body.appendChild(iframe);
};
[/#macro]
[#macro require mids]
[#--
	Excample: 
		[@require "Menu=dijit/Menu,MenuItem=dijit/MenuItem"]
		[/@]
--]
[#local mid][#if mids??][#list mids?replace("\\s*\\w+\\s*=\\s*","","r")?split(",") as d][#if d!=""][#if d_index != 0],[/#if]"${d}"[/#if][/#list][/#if][/#local]
[#local midRef][#if mids??][#list mids?replace("\\s*=\\s*[\\w|\\/|\\.|-]+\\s*","","r")?split(",") as d][#if d!=""][#if d_index != 0],[/#if]${d}[/#if][/#list][/#if][/#local]
require({async:false},[${mid}],function(${midRef}){				
		var str = arguments.callee.toString().replace(/\n*/g,"").replace(/\s*/g,"");
		 var args = str.substring(str.indexOf("(") + 1,str.indexOf(")")).split(",");
		 for(var i = args.length - 1; i >= 0; i--){
			 window[args[i]] = arguments[i];
		 }
	});
[/#macro]


[#macro define widgetClass mixin="" dependency=""]
 [@bootstrapChains "Step2/3 Initializing ${widgetClass}"]	
 [#--
	Excample: 
		[@define "agile.Application" "_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin" "Menu=dijit/Menu,MenuItem=dijit/MenuItem"]
 		[/@]
 --]

 [#local dependencies]
 	[#if dependency??]
 		[#list dependency?replace("\\s*\\w+\\s*=\\s*","","r")?split(",") as d]
 			[#if d!=""]
 				[#if d_index != 0],[/#if] "${d}"
 			[/#if]
 		[/#list]
 	[/#if]
 [/#local]
 [#local mixins]
	 [#if mixin??]
	 	[#list mixin?split(",") as m]
	 		[#if m !=""]
	 			[#if m_index != 0],[/#if] ${m}
	 		[/#if]
	 	[/#list]
	 	[#else]
 	[/#if]
[/#local]
 [#local dependencyReferences][#if dependency??][#list dependency?replace("\\s*=\\s*[\\w|\\/|\\.]+\\s*","","r")?split(",") as d][#if d!=""][#if d_index != 0],[/#if]${d}[/#if][/#list][/#if][/#local]
 if(!agile.__hasResource["${widgetClass}"]){
 //console.info("loading ${widgetClass}");
 define("${widgetClass}",[${dependencies}],function(${dependencyReferences}){
 	return declare("${widgetClass}",[${mixins}],{		
 		[#nested]
 	})
 });
 agile.__hasResource["${widgetClass}"] = true;	
 }
 [/@]
 [/#macro]

[#assign defaultStyle]font:12px Myriad,Helvetica,Tahoma,Arial,clean,sans-serif[/#assign]
[#macro logo webAppVersion=""]
<table cell-padding="0px" cell-spacing="0px">
<tr>
	<td rowspan="2" valign="buttom"><div style="background-image:url('/image/logo50x50.jpg');width:50px;height:34px;background-repeat: no-repeat"></div></td>
	<td nowrap style="font-weight:bold;font-size:2.0em;letter-spacing:0.05em;text-shadow:1px 1px 0px #cccccc">
		Beyond Prototype 			
	</td>		
	<td><span style="font-size:1.2em;font-style:italic">[#--Build at ${.now?string("yyyy-MM-dd HH:mm:ss:SSSSS")} --][#--${webAppVersion}--]</span></td>
</tr>
<tr>
	<td nowrap style="color:#008000;font-size:0.9em;word-spacing: 0.2em" align="center">INNOVATION PRODUCTIVITY QUALITY</td>
	<td></td>
</tr>	
</table>
[/#macro]

[#macro htmlMeta]
<title>Beyond Prototype</title>  
<link rel="dns-prefetch" href="${host}">
<link rel="shortcut icon" href="/image/logo.ico" type="image/x-icon"/>
<link rel="bookmark" href="/image/logo.ico"/>
<meta name="title" content="Beyond Prototype">  
<meta name="Description" content="[@metaKeywords/]">  
<meta name="keywords" content="[@metaKeywords/]">
<meta name="author" content="Beyond Prototype">  
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="x-dns-prefetch-control" content="on">
[/#macro]

[#assign fullscreen][#if applicationMode = "DEV"]''[#else]'left=0,top=0,width=' + (screen.availWidth) + ',height=' + (screen.availHeight) + ',resizable=yes,status=no,toolbar=no,location=no,menubar=no,titlebar=no,hotkeys=yes'[/#if][/#assign]
